import { appDataDir, join } from '@tauri-apps/api/path';

const config = async () => {
  const app = import.meta.env.MODE === 'development' ? await join(await appDataDir(), 'dev') : await appDataDir();
  return {
    development: {
      path: {
        app,
        tmp: await join(app, 'tmp'),
        files: await join(app, 'files'),
        data: await join(app, 'data'),
        download: await join(app, 'download'),
        tpl: await join(app, 'tpl'),
      },
      salt: 'huaron20220805',
    },
    production: {
      path: {
        app,
        tmp: await join(app, 'tmp'),
        files: await join(app, 'files'),
        data: await join(app, 'data'),
        download: await join(app, 'download'),
        tpl: await join(app, 'tpl'),
      },
      salt: 'huaron20220805',
    },
  };
};

export default async () => {
  return (await config())[import.meta.env.MODE as 'development' | 'production'];
};
